package com.example.konwRice;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class opinion extends Fragment {
    private EditText editText;
    private Button button;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_opinion, container, false);
        editText = (EditText) root.findViewById(R.id.feedback_content);
        EditText editText1=(EditText) root.findViewById(R.id.telephone);
        button = (Button) root.findViewById(R.id.feedback_submit);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String content = editText.getText().toString();
                if (!TextUtils.isEmpty(content)) {
                    Toast.makeText(getContext().getApplicationContext(), "感谢您的反馈！",
                            Toast.LENGTH_SHORT).show();

                    editText.setText("");
                    //此处写处理逻辑
                } else {
                    Toast.makeText(getContext().getApplicationContext(), "请您输入内容！",
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
        return root;
    }

}